'use strict'
//引入模块
let Koa = require('koa');
let bodyparser = require('koa-bodyparser');
let staticRes = require('koa-static');

//引入执行代码操作文件或文件夹路径
let model = require('./model');
let centre = require('./centre');
let temple = require('./temple');
let session = require('./session');

//实例化服务器
let app = new Koa();

//处理静态文件
app.use(staticRes(__dirname + '/static'));

//注册中间件
app.use(bodyparser());

app.use(temple);

app.use(centre());

app.use(session(app));

//初始化数据表
(async () => {
    // await model.sync();
})();


let port = 3000;
app.listen(port);

console.log(`http://127.0.0.1:${port}`);
